Ubuntu 16.04
Sponsored Link

Create Mirroring Volume
2016/09/12
 
Create Mirroring Volume.
[1] For example, create a Mirroring Volume with Phisical Volume /dev/sdb1 and /dev/sdc1.
# create vlume group "vg_mirror" with /dev/sdb1 and /dev/sdc1

root@dlp:~#
vgcreate vg_mirror /dev/sdb1 /dev/sdc1

  Logical volume "vg_mirror" created
# create mirroring volume

root@dlp:~#
lvcreate -L 50G -m1 -n lv_mirror vg_mirror

  Logical volume "lv_mirror" created.

root@dlp:~#
lvdisplay /dev/vg_mirror/lv_mirror

  --- Logical volume ---
  LV Path                /dev/vg_mirror/lv_mirror
  LV Name                lv_mirror
  VG Name                vg_mirror
  LV UUID                rZ8OdK-L0Hi-pRbj-l0N3-Wj56-1RaX-kLHleg
  LV Write Access        read/write
  LV Creation host, time node04.srv.world, 2016-09-14 16:06:11 +0900
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             3840
  Mirrored volumes       2
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:6
[2] Configure like follows if you'd like to set mirroring volume from a logical volume which is already running.
# extend volume group

root@dlp:~#
vgextend vg_data /dev/sdc1

  Volume group "vg_data" successfully extended
# set mirror volume

root@dlp:~#
lvconvert -m1 /dev/vg_data/lv_data /dev/sdc1
# confirm (complete to sync if Cpy%Sync turns 100)

root@dlp:~#
lvs

  LV      VG      Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root    ubuntu  -wi-ao---- 45.62g
  swap    ubuntu  -wi-ao----  3.89g
  lv_data vg_data rwi-a-r--- 50.00g                                    1.34
[3] Unset Mirroring Volume.
# specify -m0 to unset

root@dlp:~#
lvconvert -m0 /dev/vg_data/lv_data

root@dlp:~#
lvs -a -o vg_name,name,devices,size

  VG      LV      Devices        LSize
  ubuntu  root    /dev/sda2(996) 45.62g
  ubuntu  swap    /dev/sda2(0)    3.89g
  vg_data lv_data /dev/sdb1(0)   50.00g
 
Tweet